/*
 *
 * *******************************************************************
 *   @项目名称: BHex Android
 *   @文件名称: CoinPairBean.java
 *   @Date: 11/29/18 3:21 PM
 *   @Author: chenjun
 *   @Copyright（C）: 2018 BlueHelix Inc.   All rights reserved.
 *   注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的.
 *  *******************************************************************
 *
 */

package io.bhex.sdk.quote.bean;

import androidx.annotation.Nullable;

import java.io.Serializable;

public class CoinPairBean implements Serializable{
    /**
     * symbolId : XRPBTC
     * baseTokenId : XRP
     * quoteTokenId : BTC
     * quote : {"time":1528967155055,"close":"6497.37","high":"6497.37","low":"6489.23","open":"6489.23","volume":"7.303917718593991E7"}
     * portfolio : false
     */
    private int coinType = 0;//${COIN_TYPE}币种类型 币币 0 期权 1 合约 2
    private int itemShowType = 0;//list 显示类型 针对 MarketListMultiAdapter 中的 ITEM_TYPE
    private boolean buyMode=true;//是不是交易买的类型
    private boolean isNeedSwitchTradeTab;//是否需要切换到交易tab
    private String orgId;//券商id
    private String exchangeId;
    private String symbolId;
    private String symbolName;
    private String baseTokenId;
    private String baseTokenName;
    private String quoteTokenId;
    private String quoteTokenName;
    private String basePrecision;//最小数量精度
    private String minPricePrecision; // 最小价格精度/ 最小交易价格/ 每次价格变动，最小的变动单位
    private String quotePrecision;//最小金额精度

    private String minTradeQuantity;// 单次交易最小交易base的数量
    private String minTradeAmount; // 最小交易额

    private int baseDigit;//默认显示精度 （数量）
    private int priceDigit;//默认显示精度 （价格）
    private int amountDigit;//默认显示精度 （金额）
    private TickerBean ticker;
    private boolean favorite;// 是否自选
    private boolean select;// 是否被选中
    /**
     * digitMerge :
     * canTrade : true
     * minTradeQuantity : 0.000100000000000000
     * minTradeAmount : 0.100000000000000000
     * minPricePrecision : 0.100000000000000000
     */

    private String digitMerge;//行情合并单位
    private boolean canTrade;// 能否交易

    private String tag;

    public BaseTokenOption baseTokenOption;     //期权baseToken信息
    public FuturensBaseToken baseTokenFutures;    // 合约baseToken信息
    /**
     * customOrder : 10
     * baseTokenOption : {"tokenId":"BTC0328CS3900","strikePrice":"3900.0","issueDate":"1553497200000","settlementDate":"1564302600000","isCall":1,"maxPayOff":"500.0","coinToken":"USDT","indexToken":"BTCUSDT","settleStatus":"SETTLE_NO","optionType":"CALL","underlyingId":"BTC"}
     * firstLevelUnderlyingId : MAIN_BOARD
     * firstLevelUnderlyingName : 主板
     * secondLevelUnderlyingId : BTC
     * secondLevelUnderlyingName : BTC
     */

    private int customOrder;    //后端排序使用
    private String firstLevelUnderlyingId;
    private String firstLevelUnderlyingName;
    private String secondLevelUnderlyingId;
    private String secondLevelUnderlyingName;
    /**
     * baseTokenFutures : {"tokenId":"BTC-PERP-REV","displayTokenId":"USDT","issueDate":"1567497600000","settlementDate":"4723084800000","coinToken":"TBTC","currency":"USD","currencyDisplay":"$","contractMultiplier":"1.0","limitDownInTradingHours":"0.0","limitUpInTradingHours":"0.0","limitDownOutTradingHours":"0.0","limitUpOutTradingHours":"0.0","maxLeverage":"100.0","levers":["2","5","10","20","50","100"],"riskLimits":[{"riskLimitId":"200000001","riskLimitAmount":"1000000.0","maintainMargin":"0.005","initialMargin":"0.01","side":"BUY_OPEN"},{"riskLimitId":"200000002","riskLimitAmount":"2000000.0","maintainMargin":"0.01","initialMargin":"0.02","side":"BUY_OPEN"},{"riskLimitId":"200000003","riskLimitAmount":"3000000.0","maintainMargin":"0.015","initialMargin":"0.03","side":"BUY_OPEN"},{"riskLimitId":"200000004","riskLimitAmount":"4000000.0","maintainMargin":"0.02","initialMargin":"0.04","side":"BUY_OPEN"}],"overPriceRange":["-0.1","0.1"],"marketPriceRange":["-0.005","0.005"],"indexToken":"USDTBTC","displayIndexToken":"BTCUSDT","marginPrecision":"0.00000001"}
     * isReverse : true
     */

    private boolean isReverse;  //判断是否是反向合约

    private int category;      //推荐币种增加币种类型参数：1-币币 2-创新币 3-期权 4-合约
    /**
     * indexRecommendOrder : 0
     * showStatus : true
     */

    private int indexRecommendOrder;
    private boolean showStatus; //是否显示当前币对


//    public void setQuoteFromTicker(TickerBean data) {
//        QuoteBean quote = getQuote();
//        if (quote == null) {
//            quote = new QuoteBean();
//        }
//        quote.setH(data.getH());
//        quote.setO(data.getO());
//        quote.setL(data.getL());
//        quote.setC(data.getC());
//        quote.setT(data.getT());
//        quote.setV(data.getV());
//        setQuote(quote);
//    }

    public int getIndexRecommendOrder() {
        return indexRecommendOrder;
    }

    public void setIndexRecommendOrder(int indexRecommendOrder) {
        this.indexRecommendOrder = indexRecommendOrder;
    }

    public boolean isShowStatus() {
        return showStatus;
    }

    public void setShowStatus(boolean showStatus) {
        this.showStatus = showStatus;
    }

    public static class BaseTokenOption implements Serializable {
        public int dataCategory=0;//0默认是实体，1是数据分类类别标题
        public String categoryId;//数据分类类别标题id
        public String categoryName;//数据分类类别标题名称
        public String tokenId;
        public String strikePrice;
        public String issueDate;
        public String settlementDate;
        public String isCall;
        public String maxPayOff;
        public String coinToken;
        public String indexToken;
        public String settleStatus;
        public String optionType;
        public String underlyingId;
        /*"tokenId": "W_BTC_CALL_0118",//期权Id
                "strikePrice": "10.0",//行权价
                "issueDate": "1547100893000",//生效(上线)日期
                "settlementDate": "1547792101000",//到期(交割)时间
                "isCall": 1,//call or put
                "maxPayOff": "0.0",//最大盈亏（最大收益）
                "coinToken": "USDT",//计价货币
                "indexToken": "BTCUSDT"//计价货币
                 "settleStatus": "SETTLE_NO",
                "optionType": "CALL",
                "underlyingId": "BTC"
                */
    }



    public boolean isNeedSwitchTradeTab() {
        return isNeedSwitchTradeTab;
    }

    public void setNeedSwitchTradeTab(boolean needSwitchTradeTab) {
        isNeedSwitchTradeTab = needSwitchTradeTab;
    }

    public void Copy(CoinPairBean bean){
        this.buyMode = bean.buyMode;//是不是交易买的类型
        this.isNeedSwitchTradeTab = bean.isNeedSwitchTradeTab;//是否需要切换到交易tab
        this.orgId = bean.orgId;//券商id
        this.exchangeId = bean.exchangeId;
        this.symbolId = bean.symbolId;
        this.symbolName = bean.symbolName;
        this.baseTokenId = bean.baseTokenId;
        this.baseTokenName = bean.baseTokenName;
        this.quoteTokenId = bean.quoteTokenId;
        this.quoteTokenName = bean.quoteTokenName;
        this.basePrecision = bean.basePrecision;//最小数量精度
        this.minPricePrecision = bean.minPricePrecision; // 最小价格精度/ 最小交易价格/ 每次价格变动，最小的变动单位
        this.quotePrecision = bean.quotePrecision;//最小金额精度

        this.minTradeQuantity = bean.minTradeQuantity;// 单次交易最小交易base的数量
        this.minTradeAmount = bean.minTradeAmount; // 最小交易额

        this.baseDigit = bean.baseDigit;//默认显示精度 （数量）
        this.priceDigit = bean.priceDigit;//默认显示精度 （价格）
        this.amountDigit = bean.amountDigit;//默认显示精度 （金额）
        this.ticker = bean.ticker;
        this.favorite = bean.favorite;// 是否自选
        this.baseTokenOption = bean.baseTokenOption;

        this.customOrder=bean.customOrder;
        this.firstLevelUnderlyingId=bean.firstLevelUnderlyingId;
        this.firstLevelUnderlyingName=bean.firstLevelUnderlyingName;
        this.secondLevelUnderlyingId=bean.secondLevelUnderlyingId;
        this.secondLevelUnderlyingName=bean.secondLevelUnderlyingName;
    }

    public int getCoinType() {
        return coinType;
    }

    public void setCoinType(int coinType) {
        this.coinType = coinType;
    }

    public int getItemShowType() {
        return itemShowType;
    }

    public void setItemShowType(int itemShowType) {
        this.itemShowType = itemShowType;
    }

    public String Tag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }
    public boolean isBuyMode() {
        return buyMode;
    }

    public void setBuyMode(boolean buyMode) {
        this.buyMode = buyMode;
    }

    public String getSymbolId() {
        return symbolId;
    }

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public void setSymbolId(String symbolId) {
        this.symbolId = symbolId;
    }

    public String getBaseTokenId() {
        return baseTokenId;
    }

    public void setBaseTokenId(String baseTokenId) {
        this.baseTokenId = baseTokenId;
    }

    public String getQuoteTokenId() {
        return quoteTokenId;
    }

    public void setQuoteTokenId(String quoteTokenId) {
        this.quoteTokenId = quoteTokenId;
    }

    public TickerBean getTicker() {
        return ticker;
    }

    public void setTicker(TickerBean ticker) {
        this.ticker = ticker;
    }

    public String getExchangeId() {
        return exchangeId;
    }

    public void setExchangeId(String exchangeId) {
        this.exchangeId = exchangeId;
    }

    public boolean isFavorite() {
        return favorite;
    }

    public void setFavorite(boolean favorite) {
        this.favorite = favorite;
    }

    public String getDigitMerge() {
        return digitMerge;
    }

    public void setDigitMerge(String digitMerge) {
        this.digitMerge = digitMerge;
    }

    public boolean isCanTrade() {
        return canTrade;
    }

    public void setCanTrade(boolean canTrade) {
        this.canTrade = canTrade;
    }

    public String getMinTradeQuantity() {
        return minTradeQuantity;
    }

    public void setMinTradeQuantity(String minTradeQuantity) {
        this.minTradeQuantity = minTradeQuantity;
    }

    public String getMinTradeAmount() {
        return minTradeAmount;
    }

    public void setMinTradeAmount(String minTradeAmount) {
        this.minTradeAmount = minTradeAmount;
    }

    public String getMinPricePrecision() {
        return minPricePrecision;
    }

    public void setMinPricePrecision(String minPricePrecision) {
        this.minPricePrecision = minPricePrecision;
    }

    public String getBasePrecision() {
        return basePrecision;
    }

    public void setBasePrecision(String basePrecision) {
        this.basePrecision = basePrecision;
    }

    public String getQuotePrecision() {
        return quotePrecision;
    }

    public void setQuotePrecision(String quotePrecision) {
        this.quotePrecision = quotePrecision;
    }

    public String getSymbolName() {
        return symbolName;
    }

    public void setSymbolName(String symbolName) {
        this.symbolName = symbolName;
    }

    public String getBaseTokenName() {
        return baseTokenName;
    }

    public void setBaseTokenName(String baseTokenName) {
        this.baseTokenName = baseTokenName;
    }

    public String getQuoteTokenName() {
        return quoteTokenName;
    }

    public void setQuoteTokenName(String quoteTokenName) {
        this.quoteTokenName = quoteTokenName;
    }

    public int getBaseDigit() {
        return baseDigit;
    }

    public void setBaseDigit(int baseDigit) {
        this.baseDigit = baseDigit;
    }

    public int getPriceDigit() {
        return priceDigit;
    }

    public void setPriceDigit(int priceDigit) {
        this.priceDigit = priceDigit;
    }

    public int getAmountDigit() {
        return amountDigit;
    }

    public void setAmountDigit(int amountDigit) {
        this.amountDigit = amountDigit;
    }

    public int getCustomOrder() {
        return customOrder;
    }

    public void setCustomOrder(int customOrder) {
        this.customOrder = customOrder;
    }

    public String getFirstLevelUnderlyingId() {
        return firstLevelUnderlyingId;
    }

    public void setFirstLevelUnderlyingId(String firstLevelUnderlyingId) {
        this.firstLevelUnderlyingId = firstLevelUnderlyingId;
    }

    public String getFirstLevelUnderlyingName() {
        return firstLevelUnderlyingName;
    }

    public void setFirstLevelUnderlyingName(String firstLevelUnderlyingName) {
        this.firstLevelUnderlyingName = firstLevelUnderlyingName;
    }

    public String getSecondLevelUnderlyingId() {
        return secondLevelUnderlyingId;
    }

    public void setSecondLevelUnderlyingId(String secondLevelUnderlyingId) {
        this.secondLevelUnderlyingId = secondLevelUnderlyingId;
    }

    public String getSecondLevelUnderlyingName() {
        return secondLevelUnderlyingName;
    }

    public void setSecondLevelUnderlyingName(String secondLevelUnderlyingName) {
        this.secondLevelUnderlyingName = secondLevelUnderlyingName;
    }

    public boolean isReverse() {
        return isReverse;
    }

    public void setReverse(boolean reverse) {
        isReverse = reverse;
    }

    public int getCategory() {
        return category;
    }

    public void setCategory(int category) {
        this.category = category;
    }

    public boolean isSelect() {
        return select;
    }

    public void setSelect(boolean select) {
        this.select = select;
    }

    public boolean isEquals(@Nullable Object obj) {
        if(this==obj) return true;
        if(obj==null) return false;

        if(getClass()!=obj.getClass())  return false;

        CoinPairBean other=(CoinPairBean)obj;

        return this.getSymbolId().equals(other.getSymbolId()) && this.orgId.equals(other.orgId) && this.exchangeId.equals(other.getExchangeId());
    }
}
